﻿using System;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Linq;
using System.Text;

namespace DTC.Validations
{
    class DateValidation : ValidationRule
    {
        public DateValidation()
        {
        }
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            if (value is string)
            {
                string input = value as string;
                DateTime Date;
                if (DateTime.TryParse(input, out Date))
                    return new ValidationResult(true, null);
                else return new ValidationResult(false, "Неправильно указанна дата");
            }
            else return new ValidationResult(false, "Неизвестная ошибка");
        }
    }
}